package com.lam.mall.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lam.common.base.controller.BaseController;
import com.lam.common.base.domain.Result;
import com.lam.framework.annotation.ParamInject;
import com.lam.framework.operLog.annotation.Log;
import com.lam.framework.operLog.enums.BusinessType;
import com.lam.mall.entity.UserProdBrowse;
import com.lam.mall.param.UserProdBrowseParam;
import com.lam.mall.service.UserProdBrowseService;

/**
 * 会员商品足迹Controller
 * 
 * @author admin
 * @date 2023-05-12
 */
@Log(title = "会员商品足迹")
@ParamInject
@RestController
@RequestMapping("/${adminPath}/mall/userProdBrowse")
public class UserProdBrowseController extends BaseController {

    @Autowired
    private UserProdBrowseService userProdBrowseService;

    /**
     * 查询会员商品足迹列表
     */
    @Log(oper="分页查询")
    @PreAuthorize("@ss.hasPm('mall:userProdBrowse:list')")
    @GetMapping("/list")
    public Result list(UserProdBrowseParam param) {
    
        startPage();
        List<UserProdBrowse> list = userProdBrowseService.selectList(param);
        return Result.ok(getTableData(list));
    }

    /**
     * 获取会员商品足迹详细信息
     */
    @Log(oper="根据ID查询")
    @PreAuthorize("@ss.hasPm('mall:userProdBrowse:query')")
    @GetMapping("/{id}")
    public Result getInfo(@PathVariable("id") String id) {
    
        return Result.ok(userProdBrowseService.selectById(id));
    }

    /**
     * 删除会员商品足迹
     */
    @PreAuthorize("@ss.hasPm('mall:userProdBrowse:remove')")
    @Log(businessType = BusinessType.DELETE)
    @DeleteMapping("/{id}")
    public Result remove(@PathVariable String id) {
    
        return toAjax(userProdBrowseService.deleteById(id));
    }

}
